// Copyright  2004-2008 Backplane Ltd.
//
// This file is part of XPathFunctions
//
// XPathFunctions is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3 of the License, or (at your
// option) any later version.
//
// XPathFunctions is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
// more details.
//
// You should have received a copy of the GNU General Public License
// along with XPathFunctions If not, see <http://www.gnu.org/licenses/>.
//	
//
//   $Id$
// FuncLib.h : Declaration of the CFuncLib

#ifndef __FUNCLIB_H_
#define __FUNCLIB_H_

#include "resource.h"       // main symbols

/////////////////////////////////////////////////////////////////////////////
// CFuncLib
class ATL_NO_VTABLE CFuncLib : 
	public CComObjectRootEx<CComSingleThreadModel>,
	public CComCoClass<CFuncLib, &CLSID_FuncLib>,
	public IDispatchImpl<IFuncLib, &IID_IFuncLib, &LIBID_XPATHFUNCTIONSLib>
{
public:
	CFuncLib()
	{
	}

DECLARE_REGISTRY_RESOURCEID(IDR_FUNCLIB)

DECLARE_PROTECT_FINAL_CONSTRUCT()

BEGIN_COM_MAP(CFuncLib)
	COM_INTERFACE_ENTRY(IFuncLib)
	COM_INTERFACE_ENTRY(IDispatch)
END_COM_MAP()

// IFuncLib
public:
	STDMETHOD(HTMLserialise)(IDispatch *pNodeset,BOOL stripDisabled, /*[out,retval]*/ BSTR *sSerialised);
	STDMETHOD(serialise)(IDispatch *pNodeset, BOOL bEscape, BOOL stripDisabled,/*[out,retval]*/ BSTR *sSerialised);
	STDMETHOD(addHelperLibrary)(IDispatch *pHelper);
private:
	CComQIPtr<IDispatch> m_pHelper;
	HRESULT GetNodesToSerialise(IXMLDOMNodeList* pNL,BOOL stripDisabled,IXMLDOMNodeList**pNLToGo);
};

#endif //__FUNCLIB_H_
